home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
EnigmA Amiga Run 1996 June
/
EnigmA AMIGA RUN 08 (1996)(G.R. Edizioni)(IT)[!][issue 1996-06][EARSAN CD VII].iso
/
earcd
/
utilsys
/
rss14gmd.lha
/
RSys_1.4gmd
/
C
/
HandlerList.c
< prev
next >
Wrap
C/C++ Source or Header
|
1996-05-04
|
4KB
|
167 lines
/*
***************************************************************************
*
* Datei:
* RSysHandlerList.c
*
* Inhalt:
*
* --- Globale Routinen ---
*
* void MakeHandlerList ( void );
*
* --- Lokale Routinen ---
*
*
* Bemerkungen:
* Erzeugung einer Liste von Inputhandlern.
*
* Erstellungsdatum:
* 07-Jul-93 Rolf Böhme
*
* Änderungen:
* 07-Jul-93 Rolf Böhme Erstellung
*
***************************************************************************
*/
#include "RSys.h"
#include "protos.h"
/*
* MakeHandlerList() erzeugt eine Liste aller angemeldeten
* InputHandler im System. Dazu muß ein Dummy-Handler
* installiert werden und über diesen werden die anderen
* InputHandler gefunden. Es existiert keine (!) öffentliche
* Liste mit allen InputHandlern.
*/
void
MakeHandlerList (void)
{
int count = 0, i = 0;
int j;
MSGPORT *InputDevPort = NULL;
IOSTDREQ *InputRequestBlock = NULL;
INTERRUPT HandlerStuff;
NODE *LoopNode, *StartNode, *node;
DPOS;
if (InputDevPort = (MSGPORT *) CreatePort ((UBYTE *) "RSys-Check-Port", NULL))
{
if (InputRequestBlock = (IOSTDREQ *) CreateStdIO (InputDevPort))
{
if (!OpenDevice ((UBYTE *) "input.device", 0, (IOREQUEST *) InputRequestBlock, 0))
{
HandlerStuff.is_Code = NULL;
HandlerStuff.is_Data = NULL;
HandlerStuff.is_Node.ln_Pri = -127;
HandlerStuff.is_Node.ln_Name = "RSys-Check-Handler";
InputRequestBlock->io_Command = IND_ADDHANDLER;
InputRequestBlock->io_Data = (APTR) & HandlerStuff;
DoIO ((IOREQUEST *) InputRequestBlock);
/*
* Da InputHandler über Interrupts gesteuert werden
* ist hier zum Auslesen ein Disable()/Enable()-
* Paar zu verwenden
*/
Disable ();
{
for (j = 0, LoopNode = (NODE *) & (HandlerStuff.is_Node);
LoopNode && LoopNode->ln_Pred;
LoopNode = LoopNode->ln_Pred)
{
++j; /*GMD */
}
StartNode = LoopNode->ln_Succ;
for (count = 0, node = StartNode;
node->ln_Succ;
node = node->ln_Succ)
{
if (node != (NODE *) & (HandlerStuff.is_Node))
count++;
}
}
Enable ();
countentries = count;
if (NOT (NoEntries ()))
{
Entries = AllocScrollEntries (countentries);
Disable ();
{
for (LoopNode = (NODE *) & (HandlerStuff.is_Node);
LoopNode && LoopNode->ln_Pred;
LoopNode = LoopNode->ln_Pred);
StartNode = LoopNode->ln_Succ;
for (node = StartNode;
node->ln_Succ && (i < countentries);
node = node->ln_Succ)
{
if (node != (NODE *) & (HandlerStuff.is_Node))
{
savestrcpy (Entries[i].se_obj_id.fullname,
node, PARTSIZE, node->ln_Type); /*GMD */
// node, PARTSIZE, NT_INTERRUPT);
Entries[i].se_obj_id.address = node;
sprintf (Entries[i].se_Entry,
EntryAttr[INPUTHDL].ea_dataformat,
Entries[i].se_obj_id.address,
Entries[i].se_obj_id.fullname,
node->ln_Pri,
(long) ((INTERRUPT *) node)->is_Data,
(long) ((INTERRUPT *) node)->is_Code);
i++;
}
}
countentries = i;
}
Enable ();
CreateEntryList (SORT, 9);
}
InputRequestBlock->io_Command = IND_REMHANDLER;
InputRequestBlock->io_Data = (APTR) & HandlerStuff;
DoIO ((IOREQUEST *) InputRequestBlock);
CloseDevice ((IOREQUEST *) InputRequestBlock);
}
else
{
ErrorHandle ("input.device", DEVICE_ERR, OPEN_FAIL, NO_KILL);
}
DeleteStdIO (InputRequestBlock);
}
else
{
ErrorHandle ("CreateStdIO()", MISC_ERR, CREATE_FAIL, NO_KILL);
}
DeletePort (InputDevPort);
}
else
{
ErrorHandle ("RSys-Check-Port", PORT_ERR, CREATE_FAIL, NO_KILL);
}
return;
}